<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Insert Link</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style type="text/css">
table{
	font-size:12px;
}
body{
	overflow:hidden;
	margin:0px;
	padding:0px;
	padding-top:1px;
	background:url("bgcolor.gif")
}
</style>
</HEAD>
<BODY>
<table border="0" cellpadding="0" cellspacing="0" align="center">
  <tr>
    <td width="80" height="26">链接地址:</td>
    <td width="124"><input id="wordEditer_Link_ADS" value="http://"></td>
  </tr>
  <tr>
    <td height="26">链接文字:</td>
    <td><input id="wordEditer_Link_TEXT"></td>
  </tr>
  <tr align="center">
    <td height="30" colspan="2"><a onclick="insertLink();"><img src="tools_bt_ok.gif" width="42" height="19" border="0"></a>&nbsp;&nbsp;<a onclick="_cancel();"><img src="tools_bt_no.gif" width="42" height="19" border="0"></a></td>
  </tr>
</table>
<script type="text/javascript">
function _cancel() {
	window.close();
}
if(window.Event){
	var oRTE = opener.getFrameNode(opener.sRTE);
} else {
	var oRTE = dialogArguments.getFrameNode(dialogArguments.sRTE);
}
//var oRTE = dialogArguments.getFrameNode(dialogArguments.sRTE);
function insertLink() {
	var t = "_blank";
	var a = document.getElementById("wordEditer_Link_ADS").value;
	var v = document.getElementById("wordEditer_Link_TEXT").value;
	if(a == "") return;
	if(v == "") v = a;
	var html = "<a href='" + a + "' target=\"" + t + "\">" + v + "</a>";
	if(window.Event){
		var oRTE = opener.getFrameNode(opener.sRTE);
		oRTE.document.execCommand('insertHTML', false, html);
	} else {
		try{
			var oRTE = dialogArguments.getFrameNode(dialogArguments.sRTE);
			oRTE.focus();
			var oRng = oRTE.document.selection.createRange();
			oRng.pasteHTML(html);
			oRng.collapse(false);
			oRng.select();
		}catch(e){}
	}
	
	window.close();
}
function init(){
	if (document.all) {
		var selection = oRTE.document.selection; 
		if (selection != null) {
			rng = selection.createRange();
		}
	} else {
		var selection = oRTE.getSelection();
		rng = selection.getRangeAt(selection.rangeCount - 1).cloneRange();
		rng.text = rng.toString();
	}
	document.getElementById('wordEditer_Link_TEXT').value = rng.text;
}
init();
</script>
</BODY>
</HTML>
